﻿using System;
using System.Linq;

using System.Configuration;
using Global.Helpers;
namespace Gama.Service
{
    public class Ultilities
    {
        public static readonly string ConnectionStringBySqlUser = string.Format("Server={0};Database={1};User ID={2};Password={3};Trusted_Connection=False;",
                                                GamaOptions.GetAppSettingValueOrDefault("DBServerName", "")
                                                , GamaOptions.GetAppSettingValueOrDefault("DBName", "")
                                                , GamaOptions.GetAppSettingValueOrDefault("DBUserName", "")
                                                , GamaOptions.GetAppSettingValueOrDefault("DBPassword", "")
                                                );
        public static readonly string ConnectionStringByWindowUser = string.Format("Data Source={0};database={1};Integrated Security=True",
                                                GamaOptions.GetAppSettingValueOrDefault("DatabaseServerName", "")
                                                , GamaOptions.GetAppSettingValueOrDefault("DatabaseName", ""));
        public static readonly string ConnectionString = Convert.ToBoolean(GamaOptions.GetAppSettingValueOrDefault("DBLoginBySQLUser", "")) ? ConnectionStringBySqlUser : ConnectionStringByWindowUser;         
    }
}
